package com.game.service.game.redblack.match;

import com.game.service.app.Utils;
import com.game.service.app.match.MatchPlayingModel;
import com.game.service.app.match.MatchRankingModel;
import com.game.service.app.turntable.OrderModel;
import com.game.service.app.turntable.PlayingInfo;
import com.game.service.app.turntable.PlayingModel;
import com.game.service.app.turntable.TableFeeInfo;
import com.game.service.game.turntable.UserBet;
import com.game.service.windows.LogWindows;
import com.google.gson.Gson;

import java.util.ArrayList;

import static com.game.service.define.RoomConfig.GAME_ID;

public class ArrowOrder {


    /***创建订单-比赛实时排名
     *
     * @return 结算订单json
     */
    public static String createMatchRankingJson(String orderId,int eventId, ArrayList<MatchScoreRanking> list, boolean isFinal) {
        MatchRankingModel model = new MatchRankingModel();
        model.setOrderid(orderId);
        model.setGameid(GAME_ID+"");
        model.setEventid(eventId);
        model.setResult(list);
        model.setIsFinal(isFinal ? 1 : 0);
        model.setAddtime(System.currentTimeMillis());

        String json = new Gson().toJson(model);
        String sign = Utils.encryptMD5(json);
        model.setSign(sign);
        String gameResultJson = new Gson().toJson(model);
        LogWindows.getLogWindows().printToTextArea(gameResultJson, ArrowOrder.class);
        return gameResultJson;

    }

    /***创建订单-比赛游玩记录
     *
     * @return 结算订单json
     */
    public static String createMatchPayingJson(String orderId, int eventId,ArrayList<long[]> list, boolean isFinal) {
        MatchPlayingModel model = new MatchPlayingModel();
        model.setOrderid(orderId);
        model.setGameid(GAME_ID+"");
        model.setEventid(eventId);
        model.setResultShort(list);
        model.setIsFinal(isFinal ? 1 : 0);
        model.setAddtime(System.currentTimeMillis());

        String json = new Gson().toJson(model);
        String sign = Utils.encryptMD5(json);
        model.setSign(sign);
        String gameResultJson = new Gson().toJson(model);
        LogWindows.getLogWindows().printToTextArea(gameResultJson, ArrowOrder.class);
        return gameResultJson;

    }


}
